<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%
	String path = request.getContextPath(); 
	%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>功能管理</title>
<link rel="stylesheet" href="<%=path%>/easyui/themes/default/easyui.css"
	type="text/css" media="screen" />
<link rel="stylesheet" href="<%=path%>/easyui/themes/icon.css"
	type="text/css" media="screen" />
<link rel="stylesheet" href="<%=path%>/css/main.css" type="text/css"
	media="screen" />
<link rel="stylesheet" type="text/css" href="<%=path%>/css/Tooltip.css" />
<script src="<%=path%>/easyui/jquery-1.4.4.min.js"></script>
<script src="<%=path%>/easyui/jquery.easyui.min.js"></script>
<!-- mytab -->
<script src="<%=path%>/myjs/myTab.js"></script>
<!-- sys -->
<script src="<%=path%>/myjs/sys.js"></script>
<script src="<%=path%>/easyui/easyMask.js"></script>
<script src="<%=path%>/easyui/easyUI.js"></script>
<script src="<%=path%>/easyui/easyLayer.js"></script>
<script src="<%=path%>/myjs/functionManager.js"></script>

<!-- validation --><!--
<script src="<%=path%>/validation/jquery.bgiframe.min.js"></script>
<script src="<%=path%>/validation/easy_validator.pack.js"></script> -->
<script>
var greyLayer ;
		$(function(){
			debugger;
			$('#fmt').tree({
				url: 'functionManager_menutree.json',//调用菜单的json数据
				onClick:function(node){
					if(node.text=="主功能"){
						grid = $('#tt1').datagrid({
							title:'主功能管理',
							iconCls:'gngl',		
							fit:true,//表格自动填充	
							loadMsg:'正在努力为您加载，请稍作等待…',//加载信息				
							nowrap: false,
							striped: true,
							singleSelect:true,
							collapsible:false,
							url:'<%=path%>/sys_menu/getSys_menus',//请求数据
							sortName: 'id',
							sortOrder: 'desc',
							remoteSort: false,
							idField:'id',
							columns:[[							
								{field:'id',title:'功能序号',width:120,rowspan:2,sortable:true},	
								{field:'menu_name',title:'功能名称',width:150}
							]],
							pagination:true,
							rownumbers:true,
							toolbar:[/*{
								text:'新增',
								iconCls:'icon-add',
								handler:'newSys_menu'
							},'-',{
								text:'修改',
								iconCls:'icon-edit',
								handler:'editSys_menu'
								
							},'-',{
								text:'删除',
								iconCls:'icon-remove',
								handler:'delSys_menu'
							}*/]
						});
						//初始化pagination工具开始
						var pagetool = $('#tt1').datagrid('getPager');
						pagetool.pagination({				
								beforePageText:'第',
								afterPageText:'页，共{pages}页',
								displayMsg:'显示从 {from} 到  {to} , 总记录 {total} '});
						//初始化pagination工具结束

						//编辑窗口

						$('#btn-save1,#btn-cancel1').linkbutton();
						win = $('#user-window1').window({
							collapsible:false,
							minimizable:false, 
							maximizable:true, 
							closable:true,
							onClose:function(){greyLayer.close();},
							closed:true
						});
						form = win.find('form');
						greyLayer = new easyMask(null,'100%','100%',100,'#000',8,true);
						
					}else if(node.text=="子功能"){
					
					  grid=	$('#tt1').datagrid({
							title:'子功能管理',
							iconCls:'icon-ok',
							fit:true,//表格自动填充			
							loadMsg:'正在努力为您加载，请稍作等待…',//加载信息				
							nowrap: false,
							striped: true,
							collapsible:false,
							singleSelect:true,
							url:'<%=path%>/sys_sub_menu/getSys_sub_menus',//请求数据
							sortName: 'sys_menuId',
							sortOrder: 'desc',
							remoteSort: false,
							idField:'sys_menuId',
							columns:[[
								{field:'sys_menu_id',title:'主功能序号',width:120,rowspan:2,sortable:true,
									sorter:function(a,b){
										return (a>b?1:-1);
									}
								},	
								{field:'menu_name',title:'主功能名称',width:120},
								{field:'sub_menu_id',title:'子功能序号',width:120},
								{field:'func_name',title:'功能名称',width:150,rowspan:2},
								{field:'image',title:'功能图标',width:150,rowspan:2},
								{field:'func_css',title:'标签样式',width:150,rowspan:2},
								{field:'tab_name',title:'标签名称',width:150,rowspan:2},
								{field:'func_url',title:'功能URL',width:150,rowspan:2}
							]],
							pagination:true,
							rownumbers:true,
							toolbar:[/*{
								text:'新增',
								iconCls:'icon-add',
								handler:'newSys_sub_menu'
							},'-',{
								text:'修改',
								iconCls:'icon-edit',
								handler:'editSys_sub_menu'
								
							},'-',{
								text:'删除',
								iconCls:'icon-remove',
								handler:'delSys_sub_menu'
							}*/]
						});
					//初始化pagination工具开始
						var pagetool = $('#tt1').datagrid('getPager');
						pagetool.pagination({				
								beforePageText:'第',
								afterPageText:'页，共{pages}页',
								displayMsg:'显示从 {from} 到  {to} , 总记录 {total} '});
						//初始化pagination工具结束
						//编辑窗口

						$('#btn-save2,#btn-cancel2').linkbutton();
						win = $('#user-window2').window({
							collapsible:false,
							minimizable:false, 
							maximizable:true, 
							closable:true,
							onClose:function(){greyLayer.close();},
							closed:true
						});
						form = win.find('form');
						greyLayer = new easyMask(null,'100%','100%',100,'#000',8,true);
					}
				}
			});
			
			$('body').layout();
			
			
		});
	</script>
</head>
<body>
<div region="west" title=""
	style="width: 130px; padding1: 1px; overflow: hidden;">
<ul id="fmt"></ul>
</div>
<div region="center" fit="true" style="padding: 5px 135px 5px 5px;">
<!-- 主功能 -->
<table id="tt1"></table>
<!-- 主功能结束 --> <!-- 子功能 -->
<table id="tt2"></table>
<!-- 子功能结束 --></div>
<div id="user-window1" title="创建功能主项"
	style="width: 400px; height: 200px;">
<div style="padding: 20px 10px 10px 10px;">
<style>
#form1 table tr td input{
	width:240px;
}
</style>
<form id='form1' method="post">
<table>
	<tr>
		<td>功能名称：</td>
		<td><input name="menu_name" type="text" class="easyui-validatebox" required="true" ></input></td>
	</tr>
	<tr>
		<td>功能菜单图标：</td>
		<td><input name="image" type="text" class="easyui-validatebox" required="false" ></input></td>
	</tr>
</table>
</form>

</div>
<div style="text-align: center; padding: 5px;"><a
	href="javascript:void(0)" onclick="saveSys_menu()" id="btn-save1"
	icon="icon-save">确定</a> <a href="javascript:void(0)"
	onclick="closeWindow()" id="btn-cancel1" icon="icon-cancel">取消</a></div>
</div>

<div id="user-window2" title="创建功能子项"
	style="width: 400px; height: 350px;">
<div style="padding: 20px 10px 10px 10px;">
<style>
#form2 table tr td input{
	width:240px;
}
</style>
<form id="form2" method="post">
<table id='update_table' style='display: none;'>
	<tr>
		<td>主功能名称：</td>
		<td><input class="easyui-combobox" name="sys_menuId"
			url="<%=path%>/sys_sub_menu/getSys_menus" valueField="id" textField="menu_name"
			panelHeight="auto" required="true" ></input>
		</td>
	</tr>
	<tr>
		<td>子功能名称：</td>
		<td><input name="func_name" type="text" class="easyui-validatebox" required="true" ></input></td>
	</tr>
	<tr>
		<td>功能图标：</td>
		<td><input name="image" type="text" class="easyui-validatebox" required="false"  style="height:40px;" ></input></td>
	</tr>
	<tr>
		<td>功能URL：</td>
		<td><input name="func_url" type="text" class="easyui-validatebox" required="false" style="height:40px;" ></input></td>
	</tr>
	<tr>
		<td>标签名称：</td>
		<td><input name="tab_name" type="text" class="easyui-validatebox" required="false"></input></td>
	</tr>
	<tr>
		<td>标签样式级：</td>
		<td><input name="func_css" type="text" class="easyui-validatebox" required="false" ></input></td>
	</tr>



</table>
</form>

</div>
<div style="text-align: center; padding: 5px;"><a
	href="javascript:void(0)" onclick="saveSys_sub_menu()" id="btn-save2"
	icon="icon-save">确定</a> <a href="javascript:void(0)"
	onclick="closeWindow()" id="btn-cancel2" icon="icon-cancel">取消</a></div>
</div>
</body>
</html>
